<?php
$this->headMeta()->appendHttpEquiv('Content-Type','text/html;charset=utf-8');
$this->headTitle()->setSeparator(' - ');
$this->headTitle('Website Admin Panel');
echo $this->doctype();
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/" />

<link type="text/css" rel="stylesheet" media="all" href="css/base.css" />
<link type="text/css" rel="stylesheet" media="all" href="css/jquery-ui.css" />

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<script type="text/javascript" src="fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="./fancybox/jquery.fancybox-1.3.4.css" media="screen" />
</head>
<body>
    <div class='grid_8'>
        <script type="text/javascript">
            var resourceId = <?php echo $this->resourceId?>;
            $(document).ready(function() {
                $('input[type=checkbox]').click( function() {
                        $(this).attr('check',this.checked);
                });

            });

            var setValue = function(){
                var views = '';
                $("input[name='views[]']").each(function(index){
                    if($(this).attr('checked')){
                        views += $(this).val() + '-';
                    }
                });
                views = views.substring(0,views.length - 1);
                parent.$('#views_' + resourceId).val(views);
                parent.$('#link_' + resourceId).attr('href','role/viewsdetail/resourceId/' + resourceId + '/views/' + views);
                parent.$.fancybox.close();
            }

        </script>
        <h1 style="margin-top: 15px">Chọn thông tin hiển thị</h1>
        <input type="hidden" name="resourceId" id="resourceId" value="<?php echo $this->resourceId?>">
        <ul class="listCheckbox" style="width: 650px;margin-top: 15px">
            <fieldset>
                <legend><input type="checkbox" onclick="$('input[name*=\'views\']').attr('checked', this.checked);"> SELECT ALL</legend>
            <?php foreach ($this->viewsConfig as $key=>$item) {
                    $checked = (in_array($key, $this->views)) ? "checked='checked'" : ''?>
            <li><input type="checkbox" name="views[]" value="<?php echo $key?>" <?php echo $checked?> /> <label><?php echo $item->header?></label></li>    
            <?php }?>
            </fieldset>
        </ul>
        <div style="clear: both;"></div>
        <p style="margin:20px 0 0 300px"><input onclick="setValue();" type="submit" name="btnsave" value="Lưu" class="button medium"/></p>
    </div>
</body>

</html>

